


# from fastapi import FastAPI
# app = FastAPI()
# @app.get("/")
# def read_root():
#     return {"Hello": "World"}

# @app.get("/items/{item_id}")
# def read_item(item_id: int, q: str = None):
#     return {"item_id": item_id, "q": f"接口id：{item_id}","q_context":f"q= {q}"}

# # 测试客户端（常见）使用 TestClient 编写单元测试：
# from starlette.testclient import TestClient

# def test_user_endpoint():
#     client = TestClient(app)
#     response = client.get("/items/1")
#     # response = client.get("/items/1?q=2")
#     # response = client.get("/items/10")
#     assert response.status_code == 200
#     assert response.json()["item_id"] == 1


# if __name__ == "__main__":
#     test_user_endpoint()